package com.hsmw.api.controller.pub;


import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hsmw.api.service.HsmwSmsService;
import com.hsmw.api.service.HsmwUserService;
import com.hsmw.common.base.BaseController;
import com.htn.common.core.base.DataResponse;
import com.htn.common.core.constant.CommonConstants;
import com.htn.common.core.constant.UserTypeEnum;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.HsmwItem;
import com.hsmw.domain.HsmwSms;
import com.hsmw.domain.HsmwUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "PUB-通信接口", produces = "application/json")
@RestController
@RequestMapping("/api/pub/sms")
public class SmsController extends BaseController<HsmwUserService, HsmwSms> {
	private static org.slf4j.Logger Logger = LoggerFactory.getLogger(SmsController.class);




	@Autowired
	private HsmwSmsService hsmwSmsService;

	@ApiOperation(value = "发送短信验证码", notes = "参数  手机号：username; 类型type  工长端：FOREMAN；司机端：DRIVER； 项目经理：PM")
	@PostMapping(value = "/sendSmsCode")
	public DataResponse sendSmsCode(@RequestBody JSONObject jsonObject) {
		String code = hsmwSmsService.sendSmsCode(jsonObject.getString("username"),jsonObject.getString("type"));
		return new DataResponse(code);
	}
}
